#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
    ,mybutton(new QPushButton(this))
{
    ui->setupUi(this);
    mybutton->setText("hello world");
    connect(mybutton,&QPushButton::clicked,this,&Widget::handleClick);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::handleClick()
{
    if(mybutton->text() == QString("hello world"))
        mybutton->setText("hello QT");
    else
        mybutton->setText("hello world");
}

//Widget::Widget(QWidget *parent)
//    : QWidget(parent)
//    , ui(new Ui::Widget)
//{
//    ui->setupUi(this);
//    QLineEdit* qline_edit = new QLineEdit(this);
//    qline_edit->setText("hello QT!!!");

//    connect(ui->myButton1,&QPushButton::clicked,this,&Widget::handleClick);
//}

//Widget::~Widget()
//{
//    delete ui;
//}

